home *** CD-ROM | disk | FTP | other *** search
/ Shareware Grab Bag / Shareware Grab Bag.iso / 007 / boosters.arc / GETHEAP.ASM < prev    next >
Assembly Source File  |  1985-11-05  |  2KB  |  90 lines

  1. ;**************************************************
  2. ;
  3. ;       Type
  4. ;          AnyString  =  string[255];
  5. ;          ColumnType =  0..80;
  6. ;          RowType    =  0..25;
  7. ;
  8. ;       Const
  9. ;          H  = 'H';
  10. ;          V  = 'V';
  11. ;
  12. ;       Procedure GetHeap( Page : HeapBuf;
  13. ;                            HV : Char;
  14. ;                         VAR S : AnyString;
  15. ;                             X : ColumnType;
  16. ;                             Y : RowType;
  17. ;                           LEN : Integer);
  18. ;
  19. ;       Reads string at X,Y into S for length LEN.
  20. ;       HV is either 'H' or 'V', indicating
  21. ;       a horizontal (right to left) get or a
  22. ;       vertical (top to bottom) get, respectively.
  23. ;
  24. ;       HeapBuf is a pointer to a 4000-byte page
  25. ;       on the heap.
  26. ;
  27. ;**************************************************
  28. GETHEAP proc    near
  29.     push    bp
  30.     mov    bp,sp
  31.     push    ds
  32. ;
  33. ;       ***  Set length of S
  34. ;
  35. G002:    mov    es,[bp+12]    ; segment of S
  36.     mov    di,[bp+10]    ; offset of S
  37.     mov    cx,[bp+4]    ; LEN
  38.     mov    es:[di],cl    ; set length
  39.     inc    di
  40.     push    cx
  41. ;
  42. ;       ***  Convert X,Y to offset
  43. ;
  44.     mov    bx,[bp+6]    ; get Y
  45.     dec    bx
  46.     mov    ax,bx
  47.     mov    cl,7
  48.     shl    ax,cl        ; row * 128
  49.     mov    cl,5
  50.     shl    bx,cl        ; row * 32
  51.     add    bx,ax        ; row * 160
  52.     mov    ax,[bp+8]    ; get X
  53.     dec    ax
  54.     shl    ax,1        ; col * 2
  55.     add    bx,ax        ; Heap offset
  56. ;
  57. ;       ***  Move string to S
  58. ;
  59.     pop    cx
  60.     mov    si,[bp+16]    ; Heap offset
  61.     add    si,bx        ; X,Y offset
  62.     mov    ax,[bp+18]    ; Heap Segment
  63.     mov    ds,ax
  64. ;
  65.     mov    dx,[bp+14]
  66.     cmp    dl,'v'
  67.     je    g002a
  68.     cmp    dl,'V'
  69.     je    g002a
  70.     mov    dx,2        ; Set H incr
  71.     jmp    g003
  72. G002a:    mov    dx,160        ; Set V incr
  73. ;
  74. G003:    mov    al,ds:[si]    ; get Heap char
  75.     stosb            ; store it in str
  76.     add    si,dx        ; next Heap char
  77.     loop    g003        ; loop until done
  78.     cmp    dl,2
  79.     je    g004
  80.     sub    si,158
  81. ;
  82. G004:
  83.     pop    ds
  84.     mov    sp,bp
  85.     pop    bp
  86.     ret    16
  87. GETHEAP endp
  88.  
  89.  
  90.